<?php
class CharacterClass
{
	public $id 						= -1;
	public $name 					= "";
	public $specialization 			= -1;
	public $favoredAttributeOne 	= -1;
	public $favoredAttributeTwo 	= -1;
	public $majorSkills 			= "";
	
	function __construct($id, $name, $specialization, $favAttrOne, $favAttrTwo, $majorSkills)
	{
		$this->id = $id;
		$this->name = $name;
		$this->specialization = $specialization;
		$this->favoredAttributeOne = $favAttrOne;
		$this->favoredAttributeTwo = $favAttrTwo;
		$this->majorSkills = $majorSkills;
	}
	
	public static function ConstructFromRow($row)
	{
		$id = $row["id"];
		$name = $row["name"];
		$specialization = $row["specialization"];
		$favAttrOne = $row["favored_attribute_one"];
		$favAttrTwo = $row["favored_attribute_two"];
		$majorSkills = $row["major_skills"];
		
		return new CharacterClass($id, $name, $specialization, $favAttrOne, $favAttrTwo, $majorSkills);
	}
	
	public function ToArray()
	{
		$array = array(
			"id" => $this->id,
			"name" => $this->name,
			"specialization" => $this->specialization,
			"favoredAttributeOne" => $this->favoredAttributeOne,
			"favoredAttributeTwo" => $this->favoredAttributeTwo,
			"majorSkills" => $this->majorSkills
		);
		return $array;
	}
	
	public function ToString()
	{
		$returnString = "ID: " .$this->id .", name: " .$this->name .", specialization: "
			.$this->specialization .", favored attribute one: " .$this->favoredAttributeOne
			.", favored attribute two: " .$this->favoredAttributeTwo .", major skills: "
			.$this->majorSkills;
		return $returnString;
	}
}
?>